<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="sj" uri="/struts-jquery-tags"%>
<%@ taglib prefix="sjg" uri="/struts-jquery-grid-tags"%>

<script type="text/javascript">
    var rowId = 0;

    $('.ui-reset , #refresh_creditmatrixGrid').click(function(){
        $("#creditmatrixGrid").jqGrid('setGridParam',{search:false});
        var postData = $("#creditmatrixGrid").jqGrid('getGridParam','postData');
        $.extend(postData,{searchField:"",searchString:"",searchOper:""});
        $.extend(postData,{filters:""});
        $("#creditmatrixGrid").trigger("reloadGrid");
    });

    $.subscribe('searchcreditmatrixGrid', function(event,data) {
        $("#creditmatrixGrid").jqGrid('searchGrid', {drag:true,closeAfterSearch:true,closeOnEscape:true,sopt:['eq'],caption:"Search creditmatrix"} );
    });
    
    $.subscribe('creditmatrixGridComplete',function(event,data){
        $( "#creditmatrixGrid_search" ).button( "option", "disabled", false );
        $( "#creditmatrixGrid_showhide" ).button( "option", "disabled", false );
    });
    
    $.subscribe('showhidecreditmatrixGrid', function(event,data) {
        $("#creditmatrixGrid").jqGrid('setColumns',{});
    });

</script>
<div class="gridOptsContainer">
    <sj:submit button="true" cssStyle="font-size:14px;" disabled="true" id="creditmatrixGrid_search" onClickTopics="searchcreditmatrixGrid" value="Search creditmatrix"/>
    <sj:submit button="true" cssStyle="font-size:14px;" disabled="true" id="creditmatrixGrid_showhide" onClickTopics="showhidecreditmatrixGrid" value="Show/Hide Columns"/>

</div>
<s:url id="remoteurl" action="grid-creditmatrix"/>

<sjg:grid
    id="creditmatrixGrid"
    caption="Cashmate Creditmatrix"
    dataType="json"
    href="%{remoteurl}"
    gridModel="gridModel"
    pagerButtons="true"
    pagerInput="true"
    rowList="10,20,50"
    rowNum="50"
    loadingText="Requesting Data..."
    width="970"
    shrinkToFit="true"
    pager="true"
    hoverrows="true"
    rownumbers="true"
    autoencode="true"
    viewrecords="true"
    navigator="true"
    navigatorAdd="false"
    navigatorDelete="false"
    navigatorEdit="false"
    navigatorSearch="true"
    navigatorView="true"
    onGridCompleteTopics="creditmatrixGridComplete"
    >


    <sjg:gridColumn name="creditmatrixid"
                    index="creditmatrixid"
                    title="Creditmatrix Id"
                    sortable="false"
                    key="true"
                    hidden="true"/>   
    
    <sjg:gridColumn name="loanverifications.borrowername"
                    index="loanverifications.borrowername"
                    title="Borrower"
                    sortable="true"
                    align="center"
                    />
    
    <sjg:gridColumn name="documents.documentno"
                    index="documents.documentno"
                    title="Document No"
                    sortable="true"
                    align="center"
                    />
    

     <sjg:gridColumn name="date"
                    index="date"
                    title="Date"
                    sortable="true"
                    align="center"
                    />
     
      <sjg:gridColumn name="totalcreditrating"
                    index="totalcreditrating"
                    title="Total Credit Rating"
                    sortable="true"
                    align="center"
                    />
      
      <sjg:gridColumn name="employees.completename"
                    index="employees.completename"
                    title="Employee"
                    sortable="true"
                    align="center"
                    />

</sjg:grid>
